﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;

namespace Core.Battle
{
    public class Fight
    {
        private enum FightState
        {
            RoundStart,
            Attack,
            Apply,
            RoundEnd,
        }

        private FightState currentState;

        IEntity player;
        List<IEntity> enemies;

        public Fight(IEntity player, IEnumerable<IEntity> enemies)
        {
            this.player = player;
            this.enemies = new List<IEntity>(enemies);
            currentState = FightState.RoundStart;
        }

        public void Update()
        {
            switch (currentState)
            {
                case FightState.RoundStart:
                    {
                        foreach (var entity in enemies.Concat(new IEntity[] { player }))
                        {
                            foreach (var effect in entity.Effects)
                            {
                                effect.OnRoundBegin();
                            }
                        }
                        currentState = FightState.Attack;
                    }
                    break;
                case FightState.Attack:
                    {
                        
                    }
                    break;
                case FightState.Apply:
                    {

                    }
                    break;
                case FightState.RoundEnd:
                    {

                    }
                    break;
            }
        }
    }
}
